# -*- coding: utf-8 -*-
from main.models import CurrentSite
from django.contrib.sites.models import Site

def site(request):
    c_site = Site.objects.get_current() # Получаем текущий сайт
    context_extras = {}
    try:
        current_site = CurrentSite.objects.get(site=c_site) # получаем настройки для текущего сайта
        context_extras['SITE_OBJECT'] = current_site
        context_extras['url_path'] = request.path.split('/')[1] # fix!!!!
    except CurrentSite.DoesNotExist:
        pass
    return context_extras